﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
h4 {font-size:16px; color:#c52}
.infotxt {font-size:12px}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=5d4d79d412edd39a3f1cee242a2b7d7b"></script>
<title>添加复杂内容的信息窗口</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
    var sContent = "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>广州市华侨糖厂</h4>" +
        "<div class='infotxt'>地址：广州经济技术开发区东区宏远路11号</div>" +
        "<div class='infotxt'>电话：(020)22206339</div>";
    var map = new BMap.Map("allmap");
    map.centerAndZoom(point, 15);
    map.addControl(new BMap.NavigationControl());   
    var point = new BMap.Point(113.549941, 23.123962);
    var marker = new BMap.Marker(point);
    var infoWindow = new BMap.InfoWindow(sContent);
    map.centerAndZoom(point, 16);
    map.addOverlay(marker);
    marker.addEventListener("click", function () {
        this.openInfoWindow(infoWindow);
    });
</script>

